package com.yh.threadTest.test2;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * @ClassName TestPool
 * @Description TODO
 * @Author 0715-YuHao
 * @Date 2020/11/14 15:59
 */
public class TestPool {

    public static void main(String[] args) {
        ScheduledExecutorService service = Executors.newScheduledThreadPool(2);
        service.schedule(() -> {
            System.out.println("你好");
        }, 5, TimeUnit.SECONDS);
        service.scheduleWithFixedDelay(() -> {
            System.out.println("我好");
        }, 5, 1, TimeUnit.SECONDS);
    }


}

